import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';
import 'package:get_storage/get_storage.dart';
import 'package:native_dart_package/global.dart';
import 'package:yt_devops/components/event_bus_util/eventbus_util.dart';
import 'package:yt_devops/components/log_utils.dart';
import 'package:yt_devops/resources/str_res_keys.dart';
import 'package:yt_devops/routers/router_path.dart';
import 'package:yt_devops/utils/constants/store_keys.dart';
import 'package:yt_devops/utils/navigate_utils.dart';
import 'package:yt_devops/utils/update_dialog.dart';

class SplashScrenController extends GetxController{
    final count = 0.obs;

    @override
    void onInit() {
        Log.d('SplashScrenController===onInit');
    super.onInit();

    }


    @override
    void onReady() {
        Log.d('SplashScrenController===onReady');
        GetStorage storage = GetStorage();
        storage.write(StoreKeys.appIsInit, true);
        Future.delayed(const Duration(seconds: 2),).then((value){
            Get.offAllNamed(Global.isLogin() == true
                ? RouterPath.productManageHome
                : RouterPath.login);
            EventBusUtil.getInstance().fire(SplashScreenClose());
        });
    }

    @override
    void onClose() {
        // _showUpdate('version');
    super.onClose();
    }

}
